<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="http://localhost/e-shop/xiangqu/Application/Index/View/Product/css/product.css"/>
		<script type="text/javascript">
			var ajaxUrl = "<?php echo U('Index/Product/getStock');?>"
			var gid = "<?php echo $hd['get']['gid'];?>"
			var ajaxCart = "<?php echo U('Index/Carts/addCart');?>"
			var ajaxComment = "<?php echo U('Index/Product/ajaxComment');?>"
			var Root = "http://localhost/e-shop/xiangqu";
			var uid = "<?php echo $_SESSION['uid'] ?>"
			var gid = "<?php echo $hd['get']['gid'];?>"
			var ordersUrl = "<?php echo U('Index/Orders/index');?>"
		</script>
		<script src="http://localhost/e-shop/xiangqu/Static/js/jquery-1.7.2.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="http://localhost/e-shop/xiangqu/Application/Index/View/Product/js/product.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<!--头部固定区-->
		<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!--头部固定区-->
<style type="text/css">
	#header .header_content .logined a{
		font: 400 14px/50px "微软雅黑";
	}
</style>
		<div id="header_fixed"></div>
		<div id="header">
			<div class="header_content">
				<div class="logo"><img src="http://localhost/e-shop/xiangqu/Application/Index/View/Product/images/logo.png" alt="" /></div>
				<?php if(!isset($_SESSION['username'])): ?>
				<div class="login">
					<!--<a href=""><span></span></a>-->
					<a href="<?php echo U(('Index/Register/index'));?>">注册</a>
					<a href="<?php echo U(('Index/Login/index'));?>">登录</a>
				</div>
				<?php else:  ?>
				<!--已登录begin-->
				<div class="logined">
					<a href="<?php echo U('out');?>">退出</a>
					<a href="<?php echo U('Index/Orders/myOrder');?>">我的订单</a>
					<a href="<?php echo U('Index/Carts/index');?>">购物车</a>
					<a href="<?php echo U('Index/User/index');?>"><?php echo $_SESSION['nick'] ?></a>
					<a href="<?php echo U('Index/Orders/myOrder');?>" class="face"><img src="http://localhost/e-shop/xiangqu/<?php echo $face;?>" alt="" /></a>
				</div>
				<!--已登录end-->
				<?php endif  ?>
			</div>
		</div>
		<!--头部end-->
		<!--菜单栏begin-->
		<div id="nav">
			<div class="nav_content">
				<a href="<?php echo U('Index/Index/index');?>">首页</a>
				<?php foreach ($navData as $k=>$v){?>
				<a href="<?php echo U('Index/List/index',array('cid'=>$v[cid]));?>"><?php echo $v['cname'];?></a>
				<?php }?>
				<div class="search">
					<form action="<?php echo U('Index/Search/index');?>" method="get">
						<input type="text" class="text" name="keys" placeholder="搜索" />
						<input type="submit" class="sbt" value=""/>
					</form>
				</div>
			</div>
		</div>
		<!--菜单栏end-->
		<!--菜单栏end-->
		<!--页面主体begin-->
		<div id="container">
			<!--产品购买区-->
			<div class="goods">
				<div class="g_head">
					<a href="" class="brand"><img src="http://localhost/e-shop/xiangqu/<?php echo $goodsData['logo'];?>"/></a>
					<h5><?php echo $goodsData['bname'];?></h5>
					<span class='desc'><?php echo $goodsData['desc'];?></span>
				</div>
				<!--产品图片-->
				<div class="g_img">
					<img src="http://localhost/e-shop/xiangqu/<?php echo $goodsData['bigpic']['0'];?>" alt="" />
				</div>
				<!--产品信息-->
				<div class="g_infor">
					<h2><?php echo $goodsData['gname'];?></h2>
					<dl>
						<dt class="brand">品牌</dt>
						<dd class="b_cont"><?php echo $goodsData['bname'];?></dd>
					</dl>
					<?php foreach ($specGroup as $k=>$v){?>
					<dl>
						<dt class='size'><?php echo $v['taname'];?></dt>
						<?php foreach ($v['spec'] as $kk=>$vv){?>
						<dd class="s_cont" spec="<?php echo $kk;?>"><span><?php echo $vv;?></span></dd>
						<?php }?>
					</dl>
					<?php }?>
					<dl>
						<dt class="numb">数量</dt>
						<dd>
							<button class="n_reduce">-</button>
							<input type="text" name="num" value="1" class="n_num" />
							<button class="n_add">+</button>
							<span class="n_stock">库存<span class="nn_stock"><?php echo $goodsData['stock'];?></span><?php echo $goodsData['gunit'];?></span>
						</dd>
					</dl>
					<div class="infor_bottom">
						<p class="price">￥<span class="tolprice"><?php echo $goodsData['shopprice'];?></span></p>
						<span class="s1">包邮:<?php echo $goodsData['postage'];?></span><span class='s2'><span class="ico"></span>联系卖家</span>
						<a href="javascript:;" class="a_buy">立即购买</a>
						<a href="javascript:;" class="a_car">加入购物车</a>
					</div>
				</div>
			</div>
			<!--产品购买区end-->
			<!--同类推荐begin-->
			<div class="goodssame">
				<div class="gs_title"><h2>同款推荐</h2><span class="b"></span></div>
				<div class="gs_cont">
					        <?php
        //初始化
        $hd['list']['n'] = array(
            'first' => false,
            'last'  => false,
            'total' => 0,
            'index' => 0
        );
        if (empty($sameGoods)) {
            echo '';
        } else {
            $listId = 0;
            $listShowNum=0;
            $listNextId=0;
            foreach ($sameGoods as $n) {
                //开始值
                if ($listId<0) {
                    $listId++;
                    continue;
                }
                //步长
                if($listId!=$listNextId){$listId++;continue;}
                //显示条数
                if($listShowNum>=6)break;
                //第几个值
                $hd['list'][n]['index']++;
                //第1个值
                $hd['list'][n]['first']=($listId == 0);
                //最后一个值
                $hd['list'][n]['last']= (count($sameGoods)-1 <= $listId);
                //总数
                $hd['list'][n]['total']++;
                //增加数
                $listId++;
                $listShowNum++;
                $listNextId+=1
                ?>
					<a href="<?php echo U('Index/Product/index',array('cid'=>$n[category_cid],'gid'=>$n['gid']));?>"><img src="http://localhost/e-shop/xiangqu/<?php echo $n['smallpic'];?>"/></a>
					<?php }}?>
				</div>
			</div>
			<!--同类推荐end-->
			<!--商品描述与评论区begin-->
			<div class="goodsdesc">
				<div class="gd_title">
					<ul>
						<li class='_tab'><span class="s">商品描述</span><span class="line"></span></li>
						<li class='_tab'><span class="s s2">评论</span></li>
					</ul>
				</div>
				<div class="gd_cont">
					<!--商品描述begin-->
					<div class="tab_box tabb">
						<div class="gd_tag">
							<a href="">T恤</a>
							<a href="">T恤</a>
							<a href="">T恤	</a>
							<div class="dd"></div>
						</div>
						<div class="gd_img">
							<?php echo $goodsData['gdetail'];?>
						</div>
					</div>
					<!--商品描述end-->
					<!--评论begin-->
					<div class="tab_box2 tabb">
						<div class="con_form">
							<form action="javascript:;" method="post" class="comment_form">
								<textarea name="contents" class="f_conts"></textarea>
								<input type="submit" value="添加评论" class='f_sbt' />
							</form>
						</div>
						<div class="con_cont">
							<ul>
								<?php foreach ($commentData as $k=>$v){?>
								<li>
									<a href="" class='c_face'><img src="http://localhost/e-shop/xiangqu/<?php echo $v['face'];?>" alt="" /></a>
									<a href="" class='c_name'><?php echo $v['nick'];?></a>
									<span class="conts"><?php echo $v['content'];?></span>
									<span class="c_time"><?php echo date('Y-m-d H:i:s',$v['cotime']);?></span>
								</li>
								<?php }?>
							</ul>
						</div>
					</div>
					<!--评论end-->
				</div>
			</div>
			<!--商品描述与评论end-->
			<!--喜欢这商品的人begin-->
			<div class="liker">
				<div class="l_title"><h2>喜欢这个商品的人</h2><span class="b"></span></div>
				<div class="l_face">
					    <?php if(isset($likeUser)){ ?>
						<?php foreach ($likeUser as $k=>$v){?>
						<a href="<?php echo U('Index/User/LikeGoods',array('uid'=>$v[uid]));?>,"><img src="http://localhost/e-shop/xiangqu/<?php echo $v['face'];?>" alt="" /></a>
						<?php }?>
					<?php }else{ ?>
					<h4>亲~~~~，喜欢就点个赞吧O(∩_∩)</h4>
					<?php } ?>
				</div>
			</div>
			<!--喜欢这商品的人end-->
		</div>
		<!--页面主体end-->
		
		
		<!--页面底部begin-->
		<div id="footer">
			<div class="foot_wrap">
				<div class="say">
					<p class="p1">“如果你的东西和大家都一样，那干嘛还设计它？”</p>
					<p class="p2">by  Philippe Starck</p>
				</div>
				<div class="foot_logo"></div>
				<p class='infor'>Copyright 2015 版权所有 浙ICP备12027496 <a href="">热门精选</a> <a href="">热门分类</a></p>
				<p class='link'>商务合作  友情链接： 想去网  蘑菇街 360安全网址 爱图购</p>
			</div>
		</div>
		<!--页面底部end-->
	</body>
</html>
